package com.red.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.red.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {
    @Select("select *, t.name productTypeName , u.name productUnitName from \n " +
            " product p inner join product_type t inner join product_unit u \n " +
            " on p.product_type_id = t.id  and p.product_unit_id = u.id ")
    List<Product> selectProductList(@Param(Constants.WRAPPER) QueryWrapper<Product> name);
}
